package com.example.yls.sd;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
public class MyDataBaseHelper extends SQLiteOpenHelper {
    private static final String DATABASE_NAME = "Teach.db";
    private static final int DATABASE_VERSION = 1;

    private static final String creat_student = "CREATE TABLE student ( " +
            "id INTEGER PRIMARY KEY autoincrement," +
            "title TEXT, " +
            "content TEXT, " +
            "img TEXT, " +
            "audio TEXT " +
            "videoPath TEXT, " +
            "location TEXT, " +
            "append TEXT, " +
            "createTime TEXT " +
            "updateTime TEXT, " +
            ");";
    //private static final String insert_student1 = "insert into student(no,name,birth,phone) values('201801','张力','2000-09-01','13800138000')";
    //private static final String insert_student2 = "insert into student(no,name,birth,phone) values('201802','王琦','2000-01-18','13800138001')";
   // private static final String insert_student3 = "insert into student(no,name,birth,phone) values('201803','李帅','2000-05-01','13800138002')";
    public MyDataBaseHelper(Context context) {
        super(context, DATABASE_NAME, null, DATABASE_VERSION);
    }
    @Override
    public void onCreate(SQLiteDatabase db) {
        db.execSQL(creat_student);
        //db.execSQL(insert_student1);
        //db.execSQL(insert_student2);
        //db.execSQL(insert_student3);
    }
    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        // TODO Auto-generated method stub
        db.execSQL("drop table if exists student");
        onCreate(db);
    }
}
